﻿# coding: utf-8

import wx
from wxFramework.wxMainFrame import wxMainFrame

class wxModelEditorApp(wx.PySimpleApp):
    def OnInit(self):
        IL.LoadAllImages()
        
        self._keepGoing = False
        self._mainFrame = wxMainFrame()
        
        self._mainFrame.Centre(wx.BOTH)
        self._mainFrame.Show(True)
        self.SetTopWindow(self._mainFrame)
        
        self._keepGoing = True
        
        return True
    
    def MainLoop(self):
        evtloop = wx.EventLoop()
        old = wx.EventLoop.GetActive()
        wx.EventLoop.SetActive(evtloop)
        
        while self._keepGoing:
            MODEL_EDITOR.Update()
            MODEL_EDITOR.Render()
            
            while evtloop.Pending():
                evtloop.Dispatch()
            self.ProcessIdle()
        
        wx.EventLoop.SetActive(old)
        
    def Initialize(self):
        GLOBAL_SETTING.Apply()
        